1. Field of the Invention
The present invention relates to accessing data on secondary storage devices within a computer system. More particularly, the present invention relates to a method and an apparatus for communicating with a secondary storage system through a single interface for both unbuffered secondary storage references and secondary storage references from a page cache.
2. Related Art
Secondary storage devices, such as disk drives, provide a cost-effective means for storing files containing program code and data, and for storing pages of virtual memory that cannot be accommodated in the main memory of a computer system.
Unfortunately, accesses to secondary storage devices can be extremely slow, potentially requiring millions of processor clock cycles to perform a single read operation or a write operation. Such long delays in accessing secondary storage can severely degrade computer system performance.
In order to reduce the effects of these long delays, computer systems typically maintain a page cache in fast random access memory to buffer accesses to secondary storage. Data that is read from secondary storage is first stored into the page cache before being read into a user address space. Data that is written to secondary storage is first stored into the page cache before being written to secondary storage. This enables a subsequent access to a page within the page cache to be satisfied without having to access secondary storage.
Some applications, such as database systems, perform their own buffer management in order to optimize performance. Hence, accesses for these types of applications typically communicate with the secondary storage system directly, without passing through the page cache.
As distributed computer systems become more ubiquitous, it is becoming increasingly common for a local computer system to access a storage device located on a remote computer system across a network. In this case, a page cache is most effective if it is located on the local computer system so that references to the page cache do not have to traverse the network. Unfortunately, existing operating systems typically combine the page cache into a mechanism that controls physical storage devices, and this combined mechanism is typically located near the storage device on the remote computer system.
What is needed is a method and an apparatus that facilitates separating a page cache from the mechanism that controls physical storage devices for a secondary storage system.
One embodiment of the present invention provides a system for processing a request directed to a secondary storage system. The system operates by receiving the request at an interface of the secondary storage system. This request specifies an operation to be performed on the secondary storage system, a location within the secondary storage system to which the request is directed, and an address of a target buffer located outside of the secondary storage system for holding data involved in the request. Next, the system processes the request by transferring data between the location within the secondary storage system and the target buffer located outside of the secondary storage system. If the target buffer is located within a page cache, processing the request involves communicating with the target buffer located within the page cache. If the target buffer is located within a user space of an application, processing the request involves communicating with the target buffer located within the user space without passing through the page cache.
In one embodiment of the present invention, the operation specified by the request can include a read operation to read data from the location specified within the secondary storage system into the target buffer. The operation can also include a write operation to write data from the target buffer into the location specified within the secondary storage system.
In one embodiment of the present invention, if the target buffer is located within a kernel space of the operating system, processing the request involves communicating with the target buffer located within the kernel space without passing through the page cache. In a variation on this embodiment, if the target buffer within the kernel space is referenced through a virtual address that refers to a direct memory access (DMA) device located on a remote computer system, processing the request involves communicating data between the secondary storage system and the DMA device on the remote computer system without having to buffer the data at an intermediate point between the secondary storage system and the DMA device.
In one embodiment of the present invention, processing the request can involve dividing the request into a plurality of smaller requests to be processed by at least one storage device within the secondary storage system.
In one embodiment of the present invention, processing the request can involve allowing the request to proceed asynchronously, while an application that originated the request continues executing without waiting for the request to complete. In a variation on this embodiment, if the request proceeds asynchronously, the system additionally notifies the application when the request completes.
In one embodiment of the present invention, processing the request involves translating the location within the secondary storage system specified by the request from a logical block address into a physical block address.